/* Course Page Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.course-container {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  position: relative;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Header Styles - 与Home.jsx相同的导航栏样式 */
.header {
  background-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  width: 100%;
  margin: 0;
  padding: 0;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

/* Logo Styles */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  width: 32px;
  height: 32px;
}

.logo-square {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.logo-square.red { background-color: #ff6b6b; }
.logo-square.green { background-color: #51cf66; }
.logo-square.blue { background-color: #339af0; }
.logo-square.yellow { background-color: #ffd43b; }

.logo-text {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  font-family: 'Microsoft YaHei', sans-serif;
}

/* Navigation Links */
.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: #333;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
  transition: color 0.3s ease;
  cursor: pointer;
}

.nav-link:hover {
  color: #e74c3c;
}

.nav-link.active {
  color: #e74c3c;
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #e74c3c;
  border-radius: 1px;
}

/* Menu Toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.3s ease;
}

.menu-toggle:hover {
  background-color: #e9ecef;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 20px;
  height: 16px;
}

.hamburger span {
  width: 100%;
  height: 2px;
  background-color: #333;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.menu-text {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

/* Drawer Styles */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.3s ease;
}

.desktop-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background-color: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 2001;
  animation: slideIn 0.3s ease;
}

.tablet-drawer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  background-color: white;
  z-index: 2001;
  animation: slideIn 0.3s ease;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 2001;
  animation: slideIn 0.3s ease;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.drawer-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-content {
  padding: 20px;
  height: calc(100% - 80px);
  overflow-y: auto;
}

.menu-section {
  margin-bottom: 20px;
}

.menu-item {
  padding: 12px 0;
  font-size: 16px;
  color: #333;
  cursor: pointer;
  transition: color 0.3s ease;
  border-bottom: 1px solid #f0f0f0;
}

.menu-item:hover {
  color: #e74c3c;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-divider {
  height: 1px;
  background-color: #eee;
  margin: 20px 0;
}

.drawer-footer {
  margin-top: auto;
  padding-top: 20px;
}

.register-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.register-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.register-btn:active {
  transform: translateY(0);
}

.btn-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Main Content */
.main-content {
  margin-top: 70px;
  padding: 40px 20px;
  min-height: calc(100vh - 70px);
}

.content-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  overflow-x: hidden;
}

/* Page Header */
.page-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
}

.page-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 20px;
}

/* Course Categories - 移动端横向滚动 */
.course-categories {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  justify-content: center;
  overflow-x: auto;
  padding: 0 20px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
  scroll-behavior: smooth; /* 平滑滚动 */
}

.course-categories::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.category-btn {
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  background: white;
  color: #333;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0; /* 防止按钮被压缩 */
  white-space: nowrap; /* 防止文字换行 */
  user-select: none; /* 防止文字被选中 */
  -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
}

.category-btn:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

.category-btn.active {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border-color: transparent;
}

.category-btn:active {
  transform: scale(0.95); /* 点击时的缩放效果 */
}

/* Course Grid - 移动端两列布局 */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.course-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  height: fit-content; /* 确保卡片高度自适应 */
}

.course-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.course-tag {
  position: absolute;
  top: 15px;
  right: 15px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
}

.course-image-container {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.course-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
}

.course-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.course-item:hover .course-image img {
  transform: scale(1.05);
}

/* 图片轮播控制按钮 */
.image-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  opacity: 0;
}

.course-image-container:hover .image-nav-btn {
  opacity: 1;
}

.image-nav-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.prev-btn {
  left: 8px;
}

.next-btn {
  right: 8px;
}

/* 图片指示器 */
.image-indicators {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 10;
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

.indicator.active {
  background: white;
  transform: scale(1.2);
}

.course-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.course-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-description {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1; /* 让描述占据剩余空间 */
}

.course-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.course-level,
.course-duration,
.course-students {
  font-size: 12px;
  color: #888;
  background: #f5f5f5;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.course-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto; /* 推到底部 */
}

.course-price {
  font-size: 18px;
  font-weight: 600;
  color: #ff6b6b;
}

.enroll-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

.enroll-btn:hover {
  transform: translateY(-2px);
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 1000;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px;
  cursor: pointer;
  transition: color 0.3s ease;
  color: #999;
}

.tab-item.active {
  color: #2196f3;
}

.tab-item.active .tab-icon {
  color: #2196f3;
}

.tab-item.active .tab-label {
  color: #2196f3;
  font-weight: 500;
}

.tab-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.tab-label {
  font-size: 12px;
  font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Responsive Design */
@media (min-width: 768px) and (max-width: 1023px) {
  .header-content {
    padding: 0 20px;
    height: 65px;
  }

  .logo-text {
    font-size: 22px;
  }

  .nav-links {
    gap: 20px;
  }

  .nav-link {
    font-size: 15px;
  }
}

/* 移动端特定样式 */
@media (max-width: 768px) {
  .header-content {
    padding: 0 15px;
    height: 60px;
  }

  .nav-links {
    display: none;
  }

  .logo-text {
    font-size: 20px;
  }

  .page-title {
    font-size: 2rem;
  }

  .course-categories {
    justify-content: flex-start; /* 左对齐，支持横向滚动 */
    flex-wrap: nowrap; /* 不换行 */
    gap: 12px;
    padding: 0 15px;
    margin-bottom: 30px;
  }

  .category-btn {
    padding: 8px 16px;
    font-size: 13px;
    min-width: fit-content; /* 确保按钮不会被压缩 */
  }

  .course-grid {
    grid-template-columns: repeat(2, 1fr); /* 两列布局 */
    gap: 15px;
    padding: 0 15px;
  }

  .course-item {
    max-width: none; /* 移除最大宽度限制 */
    margin: 0; /* 移除自动边距 */
    border-radius: 8px; /* 移动端圆角稍小 */
  }

  .course-item:active {
    transform: scale(0.98); /* 点击时的缩放效果 */
  }

  .course-image-container {
    height: 120px; /* 移动端图片高度调整 */
  }

  .course-image {
    height: 120px; /* 移动端图片高度调整 */
  }

  /* 移动端轮播按钮样式 */
  .image-nav-btn {
    width: 24px;
    height: 24px;
    opacity: 1;
  }

  .prev-btn {
    left: 4px;
  }

  .next-btn {
    right: 4px;
  }

  .image-indicators {
    bottom: 4px;
    gap: 3px;
  }

  .indicator {
    width: 6px;
    height: 6px;
  }

  .course-info {
    padding: 12px;
  }

  .course-title {
    font-size: 14px;
    margin-bottom: 8px;
    -webkit-line-clamp: 2; /* 限制标题行数 */
  }

  .course-description {
    font-size: 12px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .course-meta {
    gap: 8px;
    margin-bottom: 10px;
  }

  .course-level,
  .course-duration,
  .course-students {
    font-size: 10px;
    padding: 2px 6px;
  }

  .course-footer {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .course-price {
    font-size: 16px;
  }

  .enroll-btn {
    padding: 6px 12px;
    font-size: 12px;
    width: 100%;
    border-radius: 4px; /* 移动端按钮圆角稍小 */
  }

  .enroll-btn:active {
    transform: scale(0.95); /* 按钮点击效果 */
  }

  .course-tag {
    top: 10px;
    right: 10px;
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 10px;
  }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
  .header-content {
    padding: 0 10px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
  }

  .logo-text {
    font-size: 18px;
  }

  .page-title {
    font-size: 1.8rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }

  .course-categories {
    gap: 10px;
    padding: 0 10px;
  }

  .category-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .course-grid {
    gap: 12px;
    padding: 0 10px;
  }

  .course-image-container {
    height: 100px;
  }

  .course-image {
    height: 100px;
  }

  /* 小屏幕轮播按钮样式 */
  .image-nav-btn {
    width: 20px;
    height: 20px;
    opacity: 1;
  }

  .prev-btn {
    left: 2px;
  }

  .next-btn {
    right: 2px;
  }

  .image-indicators {
    bottom: 2px;
    gap: 2px;
  }

  .indicator {
    width: 4px;
    height: 4px;
  }

  .course-info {
    padding: 10px;
  }

  .course-title {
    font-size: 13px;
  }

  .course-description {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .course-meta {
    gap: 6px;
  }

  .course-level,
  .course-duration,
  .course-students {
    font-size: 9px;
    padding: 2px 4px;
  }

  .course-price {
    font-size: 14px;
  }

  .enroll-btn {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* iPad Pro Specific Styles */
@media (min-width: 768px) and (max-width: 1024px) {
  .tablet-drawer {
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    right: auto !important;
    max-width: none !important;
  }
  
  .tablet-drawer .drawer-content {
    padding: 30px;
  }
  
  .tablet-drawer .menu-item {
    font-size: 18px;
    padding: 15px 0;
  }
  
  .tablet-drawer .menu-divider {
    margin: 30px 0;
  }
  
  .tablet-drawer .drawer-footer {
    padding-top: 30px;
  }
  
  .tablet-drawer .login-btn,
  .tablet-drawer .register-btn {
    padding: 15px;
    font-size: 18px;
  }
}

/* 加载状态样式 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #e74c3c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* 错误状态样式 */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.error-container p {
  color: #e74c3c;
  font-size: 16px;
  margin-bottom: 20px;
}

.retry-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.retry-btn:hover {
  background: #c0392b;
}

/* 无课程数据样式 */
.no-courses {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.no-courses p {
  color: #666;
  font-size: 16px;
  margin: 0;
}
